Border 인터페이스

✒️ 2025-05-15 14:09 내용 수정


Swing Component의 경계를 렌더링할 수 있는 객체를 묘사하는 인터페이스

메서드 설명
paintBorder(Component c, Graphics g, int x, int y, int width, int height) 경계를 생성
Insets getBorderInsets(Component c) Component 경계의 내부 여백을 반환
boolean isBorderOpaque(); 경계가 불투명한지 여부를 반환

BorderFactory 클래스

Border를 생성하기 위한 정적 메서드를 제공하는 클래스

실선 경계(LineBorder)

메서드 설명
createLineBorder(Color color) 실선 경계를 지정된 색으로 생성
createLineBorder(Color color, int thickness) 실선 경계를 색과 두께를 설정하여 생성
createLineBorder(Color color, int thickness, boolean rounded) 실선 경계를 색과 두께, 둥근 모서리 여부를 설정하여 생성

경사진 경계(BevelBorder)

메서드 설명
createRaisedBevelBorder() 왼쪽 위가 높은 경사진 경계 생성
createLoweredBevelBorder() 오른쪽 아래가 높은 경사진 경계 생성
createBevelBorder(int type) 경사진 경계 생성. 0은 Raised, 1은 Lowered
createBevelBorder(int type, Color highlight, Color shadow) 지정된 형태의 경사진 경계 생성
createBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) 지정된 형태의 경사진 경계 생성

얕게 경사진 경계(Soft Bevel Border)

메서드 설명
createRaisedSoftBevelBorder() 왼쪽 위가 높은 경사진 경계 생성
createLoweredSoftBevelBorder() 오른쪽 아래가 높은 경사진 경계 생성
createSoftBevelBorder(int type) 경사진 경계 생성. 0은 Raised, 1은 Lowered
createSoftBevelBorder(int type, Color highlight, Color shadow) 지정된 형태의 경사진 경계 생성
createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) 지정된 형태의 경사진 경계 생성

조각된 경계(EtchedBorder)

메서드 설명
createEtchedBorder() 테두리가 조각된 형태의 경계 생성
createEtchedBorder(Color highlight, Color shadow) 색과 그림자를 설정한 조각된 경계 생성
createEtchedBorder(int type) 조각 형태를 지정한 경계 생성
createEtchedBorder(int type, Color highlight, Color shadow) 지정된 형태의 조각된 경계 생성

제목이 있는 경계(TitledBorder)

메서드 설명
createTitledBorder(String title) title이 있는 경계 생성
createTitledBorder(Border border) border 속성의 경계 생성
createTitledBorder(Border border, String title) title과 border 속성의 경계 생성

빈 경계(EmptyBorder)

메서드 설명
createEmptyBorder() 빈 경계 생성
createEmptyBorder(int top, int left, int bottom, int right) 공간을 차지하지만 그려지지 않는 경계 생성

중첩 경계(CompoundBorder)

메서드 설명
createCompoundBorder() 내부 선과 외부 선이 null 인 중첩 경계 생성
createCompoundBorder(Border outsideBorder, Border insideBorder) 내부 선과 외부 선을 전달 받은 선으로 설정한 경계 생성

무광 경계(MatteBorder)

메서드 설명
createMatteBorder(int top, int left, int bottom, int right, Color color) 지정된 설정의 무광 경계 생성
createMatteBorder(int top, int left, int bottom, int right, Icon tileIcon) 지정된 설정의 무광 경계 생성

선 경계(StrokeBorder)

메서드 설명
createStrokeBorder(BasicStroke stroke) stroke로 설정된 선 경계 생성
createStrokeBorder(BasicStroke stroke, Paint paint) stroke와 paint로 설정된 선 경계 생성

점선 경계(Dashed Border)

메서드 설명
createDashedBorder(Paint paint) paint로 지정된 점선 생성
createDashedBorder(Paint paint, float length, float spacing) 지정된 설정의 점선 생성